﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Boogman
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            BoogmanSettings.myPrefs.Load();

            comboBoxRapidFire.SelectedIndex = BoogmanSettings.myPrefs.rapidfire;
            comboBoxBloodFury.SelectedIndex = BoogmanSettings.myPrefs.bloodfury;
            comboBoxBerserking.SelectedIndex = BoogmanSettings.myPrefs.berserking;
            comboBoxStampede.SelectedIndex = BoogmanSettings.myPrefs.stampede;
            comboBoxLifeblood.SelectedIndex = BoogmanSettings.myPrefs.lifeblood;
            comboBoxCrows.SelectedIndex = BoogmanSettings.myPrefs.murderofcrows;
            comboBoxTrinket1.SelectedIndex = BoogmanSettings.myPrefs.trinket1;
            comboBoxTrinket2.SelectedIndex = BoogmanSettings.myPrefs.trinket2;
            comboBoxEngiGloves.SelectedIndex = BoogmanSettings.myPrefs.engigloves;
            comboBoxmisdirection.SelectedIndex = BoogmanSettings.myPrefs.misdirection;
            comboBoxAutoCallRevivePet.SelectedIndex = BoogmanSettings.myPrefs.autocallrevivepet;
            comboBoxVirmenpotion.SelectedIndex = BoogmanSettings.myPrefs.virmenpotion;
            comboBoxAgilityFlask.SelectedIndex = BoogmanSettings.myPrefs.agilityflask;
            comboBoxAlchemyFlask.SelectedIndex = BoogmanSettings.myPrefs.alchemyflask;
            comboBoxPauseKey.SelectedIndex = BoogmanSettings.myPrefs.PauseKey;
            switch (BoogmanSettings.myPrefs.PauseKey)
            {
                case 0:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.None;
                    break;
                case 1:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.LCTRL;
                    break;
                case 4:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.RCTRL;
                    break;
                case 5:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.LALT;
                    break;
                case 6:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.RALT;
                    break;
            }

            numericUpDownstartaoe.Value = new decimal(BoogmanSettings.myPrefs.startaoe);
            numericUpDowncallpetnr.Value = new decimal(BoogmanSettings.myPrefs.callpetnr);
            numericUpDownhealthstonepercent.Value = new decimal(BoogmanSettings.myPrefs.healthstonepercent);
            numericUpDownMendPet.Value = new decimal(BoogmanSettings.myPrefs.mendpetpercent);
            numericUpDownEatDrink.Value = new decimal(BoogmanSettings.myPrefs.EatDrink);

            checkBoxMovement.Checked = BoogmanSettings.myPrefs.DisableMovement;
            checkBoxFacing.Checked = BoogmanSettings.myPrefs.DisableFacing;
            checkBoxTargetting.Checked = BoogmanSettings.myPrefs.DisableTargetting;
        }

        private void comboBoxRapidFire_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.rapidfire = comboBoxRapidFire.SelectedIndex;
        }

        private void comboBoxBloodFury_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.bloodfury = comboBoxBloodFury.SelectedIndex;
        }

        private void comboBoxBerserking_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.berserking = comboBoxBerserking.SelectedIndex;
        }

        private void comboBoxStampede_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.stampede = comboBoxStampede.SelectedIndex;
        }

        private void comboBoxLifeblood_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.lifeblood = comboBoxLifeblood.SelectedIndex;
        }

        private void comboBoxCrows_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.murderofcrows = comboBoxCrows.SelectedIndex;
        }

        private void comboBoxTrinket1_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.trinket1 = comboBoxTrinket1.SelectedIndex;
        }

        private void comboBoxTrinket2_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.trinket2 = comboBoxTrinket2.SelectedIndex;
        }

        private void comboBoxEngiGloves_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.engigloves = comboBoxEngiGloves.SelectedIndex;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.Save();
            Close();
        }

        private void numericUpDownstartaoe_ValueChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.startaoe = (int)numericUpDownstartaoe.Value;
        }

        private void numericUpDowncallpetnr_ValueChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.callpetnr = (int)numericUpDowncallpetnr.Value;
        }

        private void comboBoxmisdirection_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.misdirection = comboBoxmisdirection.SelectedIndex;
        }

        private void comboBoxAutoCallRevivePet_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.autocallrevivepet = comboBoxAutoCallRevivePet.SelectedIndex;
        }

        private void comboBoxVirmenpotion_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.virmenpotion = comboBoxVirmenpotion.SelectedIndex;
        }

        private void comboBoxAgilityFlask_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.agilityflask = comboBoxAgilityFlask.SelectedIndex;
        }

        private void comboBoxAlchemyFlask_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.alchemyflask = comboBoxAlchemyFlask.SelectedIndex;
        }

        private void numericUpDownhealthstonepercent_ValueChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.healthstonepercent = (int)numericUpDownhealthstonepercent.Value;
        }

        private void numericUpDownMendPet_ValueChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.mendpetpercent = (int)numericUpDownMendPet.Value;
        }

        private void comboBoxPauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.PauseKey = comboBoxPauseKey.SelectedIndex;
            switch (comboBoxPauseKey.SelectedIndex)
            {
                case 0:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.None;
                    break;
                case 1:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.LCTRL;
                    break;
                case 4:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.RCTRL;
                    break;
                case 5:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.LALT;
                    break;
                case 6:
                    BoogmanSettings.myPrefs.PauseKeys = BoogmanSettings.Keypress.RALT;
                    break;
            }
        }

        private void numericUpDownEatDrink_ValueChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.EatDrink = (int)numericUpDownEatDrink.Value;
        }

        private void checkBoxMovement_CheckedChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.DisableMovement = checkBoxMovement.Checked;
        }

        private void checkBoxFacing_CheckedChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.DisableFacing = checkBoxFacing.Checked;
        }

        private void checkBoxTargetting_CheckedChanged(object sender, EventArgs e)
        {
            BoogmanSettings.myPrefs.DisableTargetting = checkBoxTargetting.Checked;
        }
    }
}
